package javachongkao.集合.PairUpfortheAutumnOuting;

import java.util.Scanner;
//7-22 Pair Up for the Autumn Outing
//The students are so excited—they can finally go on an autumn outing! The teacher says that it's a bit dangerous to go alone, so let's pair up and travel together. The pairing rule is as follows: the first person in line pairs up with the last person, the second person pairs up with the second-to-last person, and so on, forming pairs of two. Now, let's quickly organize! As soon as the teacher finishes speaking, the students pair up swiftly, ready to set off!
//
//Input Format:
//The first line is an integer n, representing the number of students. (2<=n<=50，and n is even).
//The second line contains n integers representing the student numbers, separated by spaces.
//
//Output Format:
//There are n/2 lines, each containing two integers representing the paired student numbers, separated by a space.

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        // 读取学生人数
        int n = scanner.nextInt();
        int[] students = new int[n];

        // 读取学生编号
        for (int i = 0; i < n; i++) {
            students[i] = scanner.nextInt();
        }

        // 配对并输出结果
        for (int i = 0; i < n / 2; i++) {
            System.out.println(students[i] + " " + students[n - 1 - i]);
        }

        scanner.close();
    }
}
